# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=fmt
pkgver=7.0.3
pkgrel=0
pkgdesc="Open-source formatting library for C++"
url="https://fmt.dev/latest/index.html"
arch="all"
license="MIT"
makedepends="cmake doxygen"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/fmtlib/fmt/releases/download/$pkgver/fmt-$pkgver.zip"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		$CMAKE_CROSSOPTS .
	make
}

check() {
	cmake --build . --target test
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="377efc454d902d925c2f889107ceb2dc7ed1c813f0035f91448f388558a732fd3df101161c679c23a950d3687cc5bf69eedee2bd90f41edd0b220e466759d62b  fmt-7.0.3.zip"
